const users = {
  roles: ['admin'],
  introduction: 'I am a super administrator',
  avatar: 'http://stc-new.8531.cn/assets/20200513/1589363534585_5ebbc34e77edbf103a21a6f6.jpeg',
  name: 'Super Admin'
}

export default [
  {
    url: '/ser/login',
    type: 'post',
    response: config => {
      const token = 'userToken' // tokens[userPwd]

      // mock error
      if (!token) {
        return {
          code: 60204,
          message: 'Account and password are incorrect.'
        }
      }

      return {
        'msg': '操作成功!',
        'userToken': '21232f297a57a5a743894a0e4a801fc3',
        'flag': true,
        'code': 20000,
        'data': {
          'sysUserVOS': {
            'userId': 1,
            'userName': '超级管理员',
            'departId': '1',
            'userPwd': 'YWRtaW4xMjM=',
            'userEmail': 'admin@shxt.edu.com',
            'createDate': '2017-09-10 12:12:00',
            'latestOpDate': '2016-03-16 14:05:03',
            'userTel': '18843146282',
            'userNo': 'admin',
            'locked': 0,
            'lastLoginIp': '0:0:0:0:0:0:0:1',
            'userProfile': null,
            'groupId': null,
            'userExtJson': '123',
            'selfExt1': null,
            'selfExt2': null,
            'selfExt3': null,
            'selfExt4': null,
            'selfExt5': null,
            'ext1': '',
            'ext2': '0',
            'ext3': null,
            'ext4': null,
            'ext5': null,
            'ext6': null,
            'ext7': null,
            'ext8': null,
            'ext9': null,
            'ext1Int': 0,
            'userExt2': null,
            'userExt3': null,
            'userExt4': null,
            'extStr1': null,
            'extStr2': null,
            'extStr3': null,
            'groupName': null,
            'tableName': null,
            'primary': null,
            'blobField': null
          },
          'flag': true
        }
      }
    }
  },

  // get user info
  {
    url: '/user/info\.*',
    type: 'post',
    response: config => {
      const info = users

      // mock error
      if (!info) {
        return {
          code: 50008,
          message: 'Login failed, unable to get user details.'
        }
      }
      return {
        code: 20000,
        data: info
      }
    }
  },

  // user logout
  {
    url: '/ser/logout',
    type: 'post',
    response: _ => {
      return {
        code: 20000,
        data: 'success'
      }
    }
  },
  {
    url: '/ser/getMenusByUserId',
    type: 'post',
    response: config => {
      return {
        code: 20000,
        data: []
      }
    }
  }
]
